<?php
/**
 * Enter description here ...
 * @author NgoAnhTu
 * @date 2013-10-12
 *
 */
abstract class CPanelController extends Controller {
	
	protected $TEMPLATE;
	protected $LANGUAGES;
	
	public function CPanelController() {
		parent::Controller();
		$this->checkSecurity();
		$this->TEMPLATE = "template/cpanel";
		$this->LANGUAGES = $this->getAllLanguages();
	} 
	
	protected function import() {
		echo '<link type="text/css" href="' . $this->TEMPLATE . '/css/layout.css' . '" rel="stylesheet"/>';
		echo '<script type="text/javascript" src="' . $this->TEMPLATE . '/js/jquery-1.7.1.min.js"></script>';
	}
	
	protected function richtext() {
		echo '<link type="text/css" href="' . $this->TEMPLATE . '/js/jquery-te-1.4.0.css' . '" rel="stylesheet"/>';
		echo '<script type="text/javascript" src="' . $this->TEMPLATE . '/js/jquery-te-1.4.0.min.js"></script>';
	}	
	
	protected function header() {
		require_once $this->TEMPLATE . '/header.html';
	}
	
	protected function footer() {
		require_once $this->TEMPLATE . '/footer.html';		
	}
	
	protected abstract function checkSecurity();
	
	private function getAllLanguages() {
		return LanguageDAO::getInstance()->select(DAO::FIRST_PAGE, DAO::MAX_SIZE, '', 'Code', DAO::DESC);
	}
}
?>